package com.xyz.study.design_mode.d_factory_method.mode;

/**
 * 抽象的工厂
 * @author XYZ
 * @version 1.0.0
 * @since 2021/1/18
 */
public abstract class Factory {
    /**
     * 创建 定义生成对象的流程
     * @return Product
     */
    public Product create(String name){
        Product product = generate();
        return register(name, product);
    }

    /**
     * 生成对象
     * @return Product
     */
    protected abstract Product generate();

    /**
     * 注册对象
     */
    protected abstract Product register(String name, Product product);

}
